<div class="bg-light lter b-b wrapper-md ng-scope">
    <h4 class="m-n font-thin">商品管理</h4>
</div>
<div class="wrapper-md">
    <div class="panel panel-default" ng-controller="advertisementEditCtrl">
        <div class="panel-heading m-n">
            编辑广告信息
        </div>
        <div class="panel-body">
            <form name="advertiseForm" class="form-horizontal"  method="post"  ng-submit="editAdvertise()">
                <div class="form-group">
                    <label class="col-sm-2 control-label">广告类型</label>
                    <div class="col-sm-5">
                        <select name="advertiseType" class="form-control" ng-model="advertise.advertiseTypeId">
                            <option  value="{{t.id}}" ng-repeat="t in selectList">{{t.name}}</option>
                        </select>
                    </div>
                    <div class="col-sm-5 form-text" ng-if="advertiseForm.advertiseType.$touched">
                        <span class="text text-danger" ng-if="advertiseForm.advertiseType.$error.required">广告类型是必选的</span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">链接</label>
                    <div class="col-sm-5">
                        <input type="text" name="advertiseUrl" class="form-control" placeholder="请输入广告链接(小程序链接)" ng-model="advertise.advertiseUrl" required>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">排序</label>
                    <div class="col-sm-5">
                        <input ui-jq="TouchSpin" type="text" value="0" class="form-control" data-min='0' data-step="1" ng-model="advertise.sort">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">广告图片</label>

                    <div class="col-sm-5 no-padder">
                        <div class="panel-body bg-white" ng-controller="fileUploadCtrl"  nv-file-drop="" uploader="uploader" filters="picFilter">
                            <div>
                                <!--已保存上传的-->
                                <div class="pu-item-con" ng-if="hasPicture">
                                    <div class="pu-item">
                                        <div class="pu-pic">
                                            <span class="fa fa-picture-o pu-fa"></span>
                                            <img ng-src="{{app.image.advertise}}{{advertise.imgUrl}}" class="pu-picture-pre-view"/>
                                        </div>
                                        <span class="pu-text">该图片已经上传保存,删除后可能难以找回,请勿轻易删除</span>
                                        <div class="block m-b-sm">
                                            <div>
                                                <div class="btn btn-sm btn-block btn-danger" ng-click="delAdvertisePic()">删除图片</div>
                                            </div>
                                        </div>
                                        <div class="pu-process m-b-n">
                                        </div>
                                    </div>
                                </div>

                                <div ng-if="!hasPicture">
                                    <!-- 等待保存的图片 -->
                                    <div class="pu-item-con" ng-repeat="item in uploader.queue">
                                        <div class="pu-item">
                                            <div class="pu-pic">
                                                <span class="fa fa-picture-o pu-fa" ng-if="!item.isSuccess"></span>
                                                <img ng-src="{{item.imgsrc}}" class="pu-picture-pre-view" ng-if="item.isSuccess"/>
                                            </div>
                                            <span class="pu-text">文件只能上传JPG,JPEG,GIF,PNG格式的图片文件</span>
                                            <div class="block m-b-sm">
                                                <div ng-if="item.isSuccess">
                                                    <div class="btn btn-sm btn-block btn-danger" ng-click="del(item)">图片移除</div>
                                                </div>
                                            </div>
                                            <div class="pu-process m-b-n">
                                                <div class="progress bg-light m-b-n">
                                                    <div class="progress-bar progress-bar-striped active" ng-class="{true:'bg-danger',false:'bg-success'}[item.isError]" ng-bind="{true:'上传失败',false:item.progress+'%'}[item.isError]" role="progressbar" ng-style="{ 'width': item.progress + '%' }" style="width: 100%;">{{item.progress}}%</div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <!-- 图片上传控件 -->
                                    <div class="pu-item-con" ng-if="(queueLimit>uploader.queue.length)">
                                        <div class="pu-item w-md">
                                            <div class="pu-pic">
                                                <span class="fa fa-picture-o pu-fa"></span>
                                            </div>
                                            <span>{{item.file.name}}</span>
                                            <span class="pu-text">文件只能上传JPG,JPEG,GIF,PNG格式的图片文件 (建议:上传300X300的商品图)</span>
                                            <div class="block m-b-sm">
                                                <div class="pos-rlt" ng-if="!isSuccess">
                                                    <button class="btn btn-sm btn-block btn-info">点击选择图片</button>
                                                    <input type="file" ng-model="file" class="pu-file" nv-file-select="" multiple uploader="uploader" accept="image/gif,image/jpeg,image/jpg,image/png" required>
                                                </div>
                                            </div>
                                            <div class="pu-process m-b-n">
                                            </div>
                                        </div>
                                    </div>
                                </div>

                            </div>
                        </div>
                    </div>

                </div>
                <div class="line line-dashed b-b line-lg pull-in"></div>
                <div class="form-group">
                    <div class="col-sm-4 col-sm-offset-2">
                        <button type="submit" class="btn btn-success">保存</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>




